/*package com.yxy.dao;

import com.yxy.pojo.Department;
import com.yxy.pojo.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

@Repository
public class EmployeeDao {
    private static Map<Integer, Employee> employees = null;
    @Autowired
    private Department department;
    static {
        employees = new HashMap<Integer, Employee>();
        employees.put(1,new Employee(1,"yxy","d2ssoft@qq.com",1,new Department(102,"开发部")));
        employees.put(2,new Employee(2,"nzf","d2ssoft@qq.com",1,new Department(101,"市场部")));
        employees.put(3,new Employee(3,"xzh","d2ssoft@qq.com",1,new Department(103,"咨询部")));
        employees.put(4,new Employee(4,"lw","d2ssoft@qq.com",1,new Department(104,"项目部")));
        employees.put(5,new Employee(5,"hz","d2ssoft@qq.com",1,new Department(105,"综合部")));
    }

    private static Integer initId = 6;
    @Autowired
    private DepartmentDao departmentDao;

    //增加一个员工
    public void save(Employee employee){
        if(employee.getId()==null){
            employee.setId(initId++);
        }
        employee.setDepartment(departmentDao.getDepartmentById(employee.getDepartment().getId()));
        employees.put(employee.getId(),employee);
    }
    //获得所有人员信息
    public Collection<Employee> getEmployees(){
            return employees.values();
    }

    //根据id找人员
    public Employee getEmployeeById(Integer id){
        return employees.get(id);
    }

    //根据id删除人员
    public void deleteEmpById(Integer id){
        employees.remove(id);
    }
}*/
